import React from 'react'
import { Card,Table,Button,Popconfirm} from 'antd'

let dataSource;

let url = 'https://www.304cloud.top:4321/getfeedbacklist';
        fetch(url)
        .then(res=>res.json())
        .then(res=>{
            dataSource = res.data
        })

const Feedback = () => {
    const columns = [
        {
            title:'反馈id',
            key:'feedback_id',
            width:50,
            align:'center',
            dataIndex:'feedback_id'
        },
        {
            title:'反馈者',
            dataIndex:'feedback_user_id',
            align:'center',
            width:110,
        },
        {
            title:'反馈信息',
            dataIndex:'feedback_txt',
            align:'left',
            width:150,
        },
        {
            title:'联系方式',
            dataIndex:'feedback_tel',
            align:'center',
            width:150,
        },
        {
            title:'操作',
            width:120,
            align:'center',
            render:(txt,record,index)=>{
                return(
                    <div>
                        <Popconfirm title="是否回复此条反馈信息？" 
                        onCancel={()=>console.log('用户取消删除')} 
                        onConfirm={()=>{
                            console.log('用户确定删除');
                            //此处调用删除api
                        }}
                        >
                            <Button style={{margin:"0 0.3rem"}} type="primary" size="small">是否回复</Button>
                        </Popconfirm>
                       
                    </div>
                )
            }
        },
    ]
    return (
        <Card title="反馈列表">
            <Table pagination={{defaultPageSize:6}} columns={columns} bordered dataSource={dataSource}/>
        </Card>
    )
}

export default Feedback
